package com.inspur.cloud.entity.dataspace.common;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
@ApiModel(value = "返回说明")
public class OpEntityResult<T> extends OpResult {
    @ApiModelProperty(value = "返回对象")
    private T data;

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public OpEntityResult(int code, String msg) {
        super(code, msg);
    }

    public OpEntityResult(int code, String msg, T data) {
        super(code, msg);
        this.data = data;
    }

    public OpEntityResult() {
        super();
    }

    public static OpEntityResult of(int code, String msg) {
        return new OpEntityResult(code, msg);
    }

    public static OpEntityResult fail(String msg) {
        return new OpEntityResult(-1, msg);
    }
}
